package com.aisile.crowd_funding.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @标题 CrosConfig
 * @作者 Mr.chen
 * @创建日期 2018/12/18 11:46
 * @版本号 1.0
 **/
@Configuration
public class CrosConfig {

    @Bean
    public WebMvcConfigurer webMvcConfigurer(){
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/api/**")
                .allowedOrigins("*")
                .allowCredentials(true);
            }
        };
    }
}
